<?php

include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/shared/db_connection.php';

function login($user, $pass) {
    $con = open_connect();
    $query = 'SELECT 1 FROM tblAdmin WHERE Name =' . "'" . $user . "'" . ' AND Password=' . "'" . $pass . "'" . ' LIMIT 1';
//    $query = 'CALL isValidUser("' . $user . '", "' . $pass . '")';
    $result = mysqli_query($con, $query);
//    echo $query . ' || ' . $user . ' || ' . $pass . ' || ';
//    echo mysqli_num_rows($result);
//    exit();
    if (mysqli_num_rows($result) == 1) {
        return 1;
    } else {
        return 0;
    }
    close_connect($con);
}
